#coding=utf-8
import yaml
import redis

class RedisDBConnect():

    #读取数据库配置文件
    fs = open(r"./Caps/RedisBaseConnect.yaml", encoding="utf-8")
    # fs = open(r"E:/df_autoTest/pytest/appium_AutoTest/Caps/RedisBaseConnect.yaml", encoding="utf-8")
    datas = yaml.load(fs,Loader=yaml.FullLoader)
    for i in datas:
        host = i["host"]
        port = i["port"]
        db = i["db"]
        dataPwd = i["dataPwd"]
    pool = redis.ConnectionPool(host=host,
                                port=port, db=db)
    r = redis.StrictRedis(connection_pool=pool)
    red = redis.Redis(host=host, port=port, db=db, password=dataPwd)